<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.14.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>DM-CtrlH7-BF-DevProgram: C:/Users/ASUS/Desktop/dm-ctrlH7-balance-9025test/modules/can_comm/can_comm.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectlogo"><img alt="Logo" src="50x5.png"/></td>
  <td id="projectalign">
   <div id="projectname">DM-CtrlH7-BF-DevProgram<span id="projectnumber">&#160;beta 0.1</span>
   </div>
   <div id="projectbrief">C.ONE Studio Damiao Development Board Framework</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.14.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search/",'.html');
</script>
<script type="text/javascript">
$(function() { codefold.init(); });
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search',true);
  $(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(function(){initNavTree('can__comm_8h.html','',''); });
</script>
<div id="container">
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div class="header">
  <div class="headertitle"><div class="title">can_comm.h File Reference</div></div>
</div><!--header-->
<div class="contents">

<p>用于多机CAN通信的收发模块  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;bsp_can.h&quot;</code><br />
<code>#include &quot;daemon.h&quot;</code><br />
</div>
<p><a href="can__comm_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-nested-classes" class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:CANCommInstance" id="r_CANCommInstance"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_c_a_n_comm_instance.html">CANCommInstance</a></td></tr>
<tr class="memitem:CANComm_5FInit_5FConfig_5Fs" id="r_CANComm_5FInit_5FConfig_5Fs"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_c_a_n_comm___init___config__s.html">CANComm_Init_Config_s</a></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-define-members" class="groupheader"><a id="define-members" name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:add342d0e10b78abf72ae19f079e69cd5" id="r_add342d0e10b78abf72ae19f079e69cd5"><td class="memItemLeft" align="right" valign="top"><a id="add342d0e10b78abf72ae19f079e69cd5" name="add342d0e10b78abf72ae19f079e69cd5"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>MX_CAN_COMM_COUNT</b>&#160;&#160;&#160;4</td></tr>
<tr class="memitem:a88e9b6474304ead55645ad38f1936459" id="r_a88e9b6474304ead55645ad38f1936459"><td class="memItemLeft" align="right" valign="top"><a id="a88e9b6474304ead55645ad38f1936459" name="a88e9b6474304ead55645ad38f1936459"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>CAN_COMM_MAX_BUFFSIZE</b>&#160;&#160;&#160;60</td></tr>
<tr class="memitem:a057c71fe869996752afde86bfc8e2cd3" id="r_a057c71fe869996752afde86bfc8e2cd3"><td class="memItemLeft" align="right" valign="top"><a id="a057c71fe869996752afde86bfc8e2cd3" name="a057c71fe869996752afde86bfc8e2cd3"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>CAN_COMM_HEADER</b>&#160;&#160;&#160;'s'</td></tr>
<tr class="memitem:a0e27ddd237d5911ccb21e43c691ef6b0" id="r_a0e27ddd237d5911ccb21e43c691ef6b0"><td class="memItemLeft" align="right" valign="top"><a id="a0e27ddd237d5911ccb21e43c691ef6b0" name="a0e27ddd237d5911ccb21e43c691ef6b0"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>CAN_COMM_TAIL</b>&#160;&#160;&#160;'e'</td></tr>
<tr class="memitem:ad34b43a66d5b4cc499f2d5a5674392c7" id="r_ad34b43a66d5b4cc499f2d5a5674392c7"><td class="memItemLeft" align="right" valign="top"><a id="ad34b43a66d5b4cc499f2d5a5674392c7" name="ad34b43a66d5b4cc499f2d5a5674392c7"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>CAN_COMM_OFFSET_BYTES</b>&#160;&#160;&#160;4</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-func-members" class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a611c266bef866f02414a73b7d5584f86" id="r_a611c266bef866f02414a73b7d5584f86"><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_c_a_n_comm_instance.html">CANCommInstance</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a611c266bef866f02414a73b7d5584f86">CANCommInit</a> (<a class="el" href="struct_c_a_n_comm___init___config__s.html">CANComm_Init_Config_s</a> *comm_config)</td></tr>
<tr class="memdesc:a611c266bef866f02414a73b7d5584f86"><td class="mdescLeft">&#160;</td><td class="mdescRight">初始化CANComm  <br /></td></tr>
<tr class="memitem:a034f32d1bf2deb6386ed06690f41a7a6" id="r_a034f32d1bf2deb6386ed06690f41a7a6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a034f32d1bf2deb6386ed06690f41a7a6">CANCommSend</a> (<a class="el" href="struct_c_a_n_comm_instance.html">CANCommInstance</a> *instance, uint8_t *data)</td></tr>
<tr class="memdesc:a034f32d1bf2deb6386ed06690f41a7a6"><td class="mdescLeft">&#160;</td><td class="mdescRight">通过CANComm发送数据  <br /></td></tr>
<tr class="memitem:ac3cf44018acff09b65450d846df10b6d" id="r_ac3cf44018acff09b65450d846df10b6d"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ac3cf44018acff09b65450d846df10b6d">CANCommGet</a> (<a class="el" href="struct_c_a_n_comm_instance.html">CANCommInstance</a> *instance)</td></tr>
<tr class="memdesc:ac3cf44018acff09b65450d846df10b6d"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取CANComm接收的数据,需要自己使用强制类型转换将返回的void指针转换成指定类型  <br /></td></tr>
<tr class="memitem:a3e10f1654f1cea65cdb5f1e37912140d" id="r_a3e10f1654f1cea65cdb5f1e37912140d"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a3e10f1654f1cea65cdb5f1e37912140d">CANCommIsOnline</a> (<a class="el" href="struct_c_a_n_comm_instance.html">CANCommInstance</a> *instance)</td></tr>
<tr class="memdesc:a3e10f1654f1cea65cdb5f1e37912140d"><td class="mdescLeft">&#160;</td><td class="mdescRight">检查CANComm是否在线  <br /></td></tr>
</table>
<a name="details" id="details"></a><h2 id="header-details" class="groupheader">Detailed Description</h2>
<div class="textblock"><p>用于多机CAN通信的收发模块 </p>
<dl class="section author"><dt>Author</dt><dd>Neo <a href="#" onclick="location.href='mai'+'lto:'+'neo'+'zn'+'g1@'+'hn'+'u.e'+'du'+'.cn'; return false;">neozn<span class="obfuscator">.nosp@m.</span>g1@h<span class="obfuscator">.nosp@m.</span>nu.ed<span class="obfuscator">.nosp@m.</span>u.cn</a> </dd></dl>
<dl class="section version"><dt>Version</dt><dd>0.1 </dd></dl>
<dl class="section date"><dt>Date</dt><dd>2022-11-27</dd></dl>
<dl class="section copyright"><dt>Copyright</dt><dd>Copyright (c) 2022 HNUYueLu EC all rights reserved </dd></dl>
</div><a name="doc-func-members" id="doc-func-members"></a><h2 id="header-doc-func-members" class="groupheader">Function Documentation</h2>
<a id="ac3cf44018acff09b65450d846df10b6d" name="ac3cf44018acff09b65450d846df10b6d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac3cf44018acff09b65450d846df10b6d">&#9670;&#160;</a></span>CANCommGet()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void * CANCommGet </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_c_a_n_comm_instance.html">CANCommInstance</a> *</td>          <td class="paramname"><span class="paramname"><em>instance</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>获取CANComm接收的数据,需要自己使用强制类型转换将返回的void指针转换成指定类型 </p>
<dl class="section return"><dt>Returns</dt><dd>void* 返回的数据指针 </dd></dl>
<dl class="section attention"><dt>Attention</dt><dd>注意如果希望直接通过转换指针访问数据,如果数据是union或struct,要检查是否使用了pack(n) CANComm接收到的数据可以看作是pack(1)之后的,是连续存放的. 如果使用了pack(n)可能会导致数据错乱,并且无法使用强制类型转换通过memcpy直接访问,转而需要手动解包. 强烈建议通过CANComm传输的数据使用pack(1) </dd></dl>

</div>
</div>
<a id="a611c266bef866f02414a73b7d5584f86" name="a611c266bef866f02414a73b7d5584f86"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a611c266bef866f02414a73b7d5584f86">&#9670;&#160;</a></span>CANCommInit()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="struct_c_a_n_comm_instance.html">CANCommInstance</a> * CANCommInit </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_c_a_n_comm___init___config__s.html">CANComm_Init_Config_s</a> *</td>          <td class="paramname"><span class="paramname"><em>comm_config</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>初始化CANComm </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">config</td><td>CANComm初始化结构体 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CANCommInstance* </dd></dl>

</div>
</div>
<a id="a3e10f1654f1cea65cdb5f1e37912140d" name="a3e10f1654f1cea65cdb5f1e37912140d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3e10f1654f1cea65cdb5f1e37912140d">&#9670;&#160;</a></span>CANCommIsOnline()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t CANCommIsOnline </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_c_a_n_comm_instance.html">CANCommInstance</a> *</td>          <td class="paramname"><span class="paramname"><em>instance</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>检查CANComm是否在线 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">instance</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>uint8_t </dd></dl>

</div>
</div>
<a id="a034f32d1bf2deb6386ed06690f41a7a6" name="a034f32d1bf2deb6386ed06690f41a7a6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a034f32d1bf2deb6386ed06690f41a7a6">&#9670;&#160;</a></span>CANCommSend()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CANCommSend </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_c_a_n_comm_instance.html">CANCommInstance</a> *</td>          <td class="paramname"><span class="paramname"><em>instance</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *</td>          <td class="paramname"><span class="paramname"><em>data</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>通过CANComm发送数据 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">instance</td><td>cancomm实例 </td></tr>
    <tr><td class="paramname">data</td><td>注意此地址的有效数据长度需要和初始化时传入的datalen相同 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="page-nav" class="page-nav-panel">
<div id="page-nav-resize-handle"></div>
<div id="page-nav-tree">
<div id="page-nav-contents">
</div><!-- page-nav-contents -->
</div><!-- page-nav-tree -->
</div><!-- page-nav -->
</div><!-- container -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a href="dir_e05d7e2b1ecd646af5bb94391405f3b5.html">modules</a></li><li class="navelem"><a href="dir_b7ee63bbf909f3d5edbc214bb8274d1a.html">can_comm</a></li><li class="navelem"><a href="can__comm_8h.html">can_comm.h</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.14.0 </li>
  </ul>
</div>
</body>
</html>
